package com.uni.crawl.controller.crawl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.uni.crawl.common.result.PageResult;
import com.uni.crawl.model.query.crawl.CrawlDataPageQuery;
import com.uni.crawl.model.vo.crawl.CrawlDataVO;
import com.uni.crawl.service.crawl.CrawlDataService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "爬虫数据管理接口")
@RestController
@RequestMapping("/api/v1/crawl/data")
@RequiredArgsConstructor
public class CrawlDataController {

    private final CrawlDataService crawlDataService;

    @Operation(summary = "爬虫实例分页列表")
    @PostMapping("/page")
    public PageResult<CrawlDataVO> getDictPage(@RequestBody CrawlDataPageQuery pageQuery) {
        Page<CrawlDataVO> result = crawlDataService.getPage(pageQuery);
        return PageResult.success(result);
    }
}
